<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>音频播放器</title>
    <style>
        :root {
            --bg-color: #121212;
            --text-color: #ffffff;
            --highlight-color: #ffa726;
            --secondary-text: rgba(255, 255, 255, 0.7);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            background-color: var(--bg-color);
            color: var(--text-color);
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
            height: 100vh;
            overflow: hidden;
        }

        .container {
            max-width: 600px;
            margin: 0 auto;
            padding: 20px;
            height: 100%;
            display: flex;
            flex-direction: column;
        }

        .header {
            text-align: center;
            margin-bottom: 30px;
            flex-shrink: 0; /* 防止header被压缩 */
        }

        .player-wrapper {
            margin-bottom: 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 15px;
            flex-shrink: 0; /* 防止播放器区域被压缩 */
        }

        .lyrics-container {
            flex: 1;
            min-height: 0; /* 重要：允许容器在flex布局中正确滚动 */
            overflow-y: auto;
            padding: 20px;
            border-radius: 10px;
            background-color: rgba(255, 255, 255, 0.05);
            scrollbar-width: thin;
            scrollbar-color: var(--highlight-color) transparent;
            display: flex;
            flex-direction: column;
            margin-bottom: 0; /* 移除底部边距 */
        }

        .file-input-wrapper {
            margin-bottom: 20px;
        }

        #audioFile {
            display: none;
        }

        .custom-file-input {
            padding: 10px 20px;
            background-color: var(--highlight-color);
            color: var(--bg-color);
            border-radius: 20px;
            cursor: pointer;
            font-weight: 500;
            transition: opacity 0.2s;
        }

        .custom-file-input:hover {
            opacity: 0.9;
        }

        audio {
            width: 100%;
            margin: 10px 0;
        }

        audio::-webkit-media-controls-panel {
            background-color: rgba(255, 255, 255, 0.1);
        }

        .lyrics-container {
            flex: 1;
            overflow-y: auto;
            padding: 20px;
            border-radius: 10px;
            background-color: rgba(255, 255, 255, 0.05);
            scrollbar-width: thin;
            scrollbar-color: var(--highlight-color) transparent;
        }

        .lyrics-container::-webkit-scrollbar {
            width: 6px;
        }

        .lyrics-container::-webkit-scrollbar-thumb {
            background-color: var(--highlight-color);
            border-radius: 3px;
        }

        .lyric-line {
            padding: 8px 0;
            text-align: center;
            color: var(--secondary-text);
            transition: all 0.3s ease;
            font-size: 16px;
            line-height: 1.5;
        }

        .lyric-line.active {
            color: var(--highlight-color);
            font-size: 18px;
            font-weight: 500;
        }

        .song-info {
            text-align: center;
            margin-bottom: 20px;
        }

        .song-title {
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 5px;
        }

        .song-artist {
            color: var(--secondary-text);
            font-size: 16px;
        }

        @media (max-width: 768px) {
            .container {
                padding: 15px;
            }

            .lyrics-container {
                padding: 15px;
            }

            .lyric-line {
                font-size: 14px;
            }

            .lyric-line.active {
                font-size: 16px;
            }

            .song-title {
                font-size: 20px;
            }

            .song-artist {
                font-size: 14px;
            }
        }
    </style>
    <script src="https://cdn.jsdelivr.net/npm/gbk.js@0.3.0/dist/gbk.min.js"></script>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>流畅歌词，畅享音乐</h1>
        </div>
        <div class="player-wrapper">
            <div class="file-input-wrapper">
                <label for="audioFile" class="custom-file-input">选择音频文件</label>
                <input type="file" id="audioFile" accept="audio/*" />
            </div>
            <div class="song-info">
                <div class="song-title" id="songTitle">未选择音频</div>
                <div class="song-artist" id="songArtist"></div>
            </div>
            <audio id="audio" controls></audio>
        </div>
        <div class="lyrics-container" id="lyricsContainer"></div>
    </div>
    <script src="player.js"></script>
</body>
</html>